//FileWrap.java  
//
//Copyright (C) 2008 Devon Mizelle  
//  
//This program is distributed in the hope that it will be useful,  
//but WITHOUT ANY WARRANTY; without even the implied warranty of  
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
//GNU General Public License for more details.  
//  
//You should have received a copy of the GNU General Public License  
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

package hermes;
import java.io.File;
import java.io.FileInputStream;
/**
 *
 * @author Devon Mizelle
 */

public class FileWrap implements java.io.Serializable {
    private File file = null;
    private FileInputStream fis = null;
    private byte[] buffer = null;
    private long length;
    public FileWrap(String path){
        try{
            file = new File(path);
            fis = new FileInputStream(file);
            length = file.length();
        }
        catch(Exception e){
            e.printStackTrace();
        }
        buffer = new byte[(int) file.length() + 1]; //quick and dirty hack to preserve length.
        try{
            fis.read(buffer);
            fis.close();
        }
        catch(Exception e){
            e.printStackTrace();
        
        }
    }
    
    public byte[] getFile(){
        return buffer;
    
    }
    
    public long getLength(){
        return length;
    }
    
}
